After setting up the IDE and Python environment, the next step is to configure the VXLAN
Data Model using Network as Code.
This data model streamlines VXLAN fabric configuration by abstracting automation processes and representing the desired fabric state.
Operators can simply update the configuration state within the data model, eliminating the need to develop custom playbooks with individual modules and parameters.
Utilizing straightforward YAML, the VXLAN as Code VXLAN EVPN collection enables the definition of data structures that describe the VXLAN fabric configuration for Cisco Nexus data centers. This configuration can then be deployed using Ansible and Cisco Nexus Dashboard. Even with minimal automation experience, operators can leverage this collection to instantiate a VXLAN EVPN fabric efficiently.
For your convenience, a GitHub repository containing all the required files to build the VXLAN fabric has been provided. The
initial step is to clone
the repository.
git clone https://github.com/cobedien/nac-ltrdcn-2654.git
cd nac-ltrdcn-2654
pip install --upgrade pip
pip install -r requirements.txt
ansible-galaxy collection install -r requirements.yaml
Environment variables are configured in the shell that will execute the playbook, using the export
command in Bash. This
is where you will define your local variables.
# These are the credentials for ND
export ND_HOST=10.3.0.23
export ND_DOMAIN=cl-ise
export ND_USERNAME=pod5u1
export ND_PASSWORD=cisco.123
# These are the credentials for the devices in the inventory
export NDFC_SW_USERNAME=admin
export NDFC_SW_PASSWORD=cisco.123
After cloning the base repository, you'll need to modify specific variables to adapt it to your particular POD. This example demonstrates the ease of using Network as Code (NaC) to automate Nexus Dashboard tasks..
In this particular example, the idea is to highlight how easy is to use Network As Code
to automate Nexus Dashboard tasks. We will be modifying
a port 1/10 on Site1-L1 from switchport mode trunk to switchport access vlan 2301
To streamline this process, use the sed
command to insert the appropriate POD information into the topology.nac.yaml
file.
Modify the Default Gateway
from Site1-L1
sed -i 's/<< DG >>/10.3.5.1/' host_vars/Site1/topology.nac.yaml
Modify the Manegement IP address
from Site1-L1
sed -i 's/<< MGMT >>/10.3.5.13/' host_vars/Site1/topology.nac.yaml
Login to your Site1-L1 switch using the copy command below and paste into your Terminal. When prompted, the password is cisco.123 .
show run interface ethernet 1/10
Output:
Site1-L1# show run interface ethernet 1/10
!Command: show running-config interface Ethernet1/10
!Running configuration last done at: Wed Jun 4 15:49:34 2025
!Time: Wed Jun 4 16:50:56 2025
version 10.5(3) Bios:version
interface Ethernet1/10
switchport mode trunk
switchport trunk allowed vlan none
spanning-tree port type edge trunk
mtu 9216
With the environment variables configured, the final step is to execute the playbook to provision Nexus Dashbboard with the new port configuration.
Please note that this playbook may require additional time to complete, as Network as Code will generate all necessary files for the environment in the background.
ansible-playbook -i inventory.yaml vxlan.yaml --tags cr_manage_interfaces,role_deploy
Here is the output that you should see after the playbook has completed.
TASK [cisco.nac_dc_vxlan.deploy : Mark Stage Role Deploy Completed] *************************************************** ok: [Site1 -> localhost] PLAY RECAP ************************************************************************************************************ Site1 : ok=189 changed=25 unreachable=0 failed=0 skipped=439 rescued=0 ignored=0
show run interface ethernet 1/10
Output:
Site1-L1# show run interface ethernet 1/10
!Command: show running-config interface Ethernet1/10
!Running configuration last done at: Wed Jun 4 16:52:01 2025
!Time: Wed Jun 4 16:52:34 2025
version 10.5(3) Bios:version
interface Ethernet1/10
description BlueNet1 Vlan 2301 Site1-L1 1/10
switchport access vlan 2301
spanning-tree bpduguard disable
As you can see the configuration has been updated to access proctors.
By utilizing Network As Code
, users can automate various tasks, including the creation of VRFs, VNIs,
policies, and more. This lab guide employs Network As Code
to configure the entire lab environment.
For additional details, please consult one of the proctors.
Please continue to the next section.